import java.util.Random;
import java.util.Scanner;

public class Text3 {
    public static void main(String[] args) {
        Random r = new Random ();
        //生成随机数的代码不能在循环里，否则每次都会生成一个随机数
        int number = r.nextInt(100) + 1;
        Scanner sc = new Scanner(System.in);
        while(true){
            System.out.println("请输入你要猜的数字");
            int guessNumber = sc.nextInt();
            if(guessNumber > number) {
                System.out.println("大了");
            }else if(guessNumber < number){
                System.out.println("小了");
            }else{
                System.out.println("猜中了");
                break;
            }

        }
    }
}
